#ifndef _RSSREFRESHER_H
#define _RSSREFRESHER_H

#include "DocStructure.h"
#include "DocTemplate.h"
#include "RSSDocumentLink.h"

#include "ChannelMGR.h"
#include "ItemMGR.h"
#include "TagMGR.h"

#include <string>

using namespace std;

class RSSRefresher
{
	public: //Default Function : Create & Destroy & Operator

		RSSRefresher();
		RSSRefresher( ChannelMGR* channelMGR, ItemMGR* itemMGR, TagMGR* tagMGR );
		RSSRefresher( const RSSRefresher& source );
		~RSSRefresher();

		RSSRefresher& operator = ( const RSSRefresher& source );

	public: //General Function
		bool GetNetFile( RSSDocumentLink* oldDocument );		//Get RSS Document from Web
		string SetTemplate();									//Set docStructure
		bool CheckUpdate( RSSDocumentLink* oldDocument );		//Compare oldDocument.pubDate & newDocument.pubDate
		bool Update( RSSDocumentLink* oldDocument );			//Call RSSAnalyzer
	
	public: //Access Function
		string GetNewDocument() const;
		DocStructure& GetDocStructure() const;
		
	private:
		string newDocument;									//Opened Document String
		DocStructure docStructure;							//Customizing Template for Opened Document
		ChannelMGR* channelMGR;
		ItemMGR* itemMGR;
		TagMGR* tagMGR;
		DocTemplate docTemplate;
	
};

inline string RSSRefresher::GetNewDocument() const
{
	return this->newDocument;
}

inline DocStructure& RSSRefresher::GetDocStructure() const
{
	return const_cast<DocStructure&>(this->docStructure);
}


#endif
